package com.member.shop.service.impl;

import java.util.Arrays;
import java.util.List;

import com.member.common.utils.DateUtils;

import javax.annotation.Resource;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;
import com.member.shop.mapper.SysBizNotifyUserMapper;
import com.member.shop.domain.SysBizNotifyUser;
import com.member.shop.service.ISysBizNotifyUserService;

/**
 * 公告通知用户Service业务层处理
 *
 * @author lixinchen
 * @date 2024-11-05
 */
@Service
public class SysBizNotifyUserServiceImpl extends ServiceImpl<SysBizNotifyUserMapper, SysBizNotifyUser> implements ISysBizNotifyUserService {
    @Resource
    private SysBizNotifyUserMapper sysBizNotifyUserMapper;

    /**
     * 查询公告通知用户
     *
     * @param id 公告通知用户主键
     * @return 公告通知用户
     */
    @Override
    public SysBizNotifyUser selectSysBizNotifyUserById(Long id) {
        return sysBizNotifyUserMapper.selectById(id);
    }

    /**
     * 查询公告通知用户列表
     *
     * @param queryWrapper 公告通知用户
     * @return 公告通知用户
     */
    @Override
    public List<SysBizNotifyUser> selectSysBizNotifyUserList(LambdaQueryWrapper<SysBizNotifyUser> queryWrapper) {
        return sysBizNotifyUserMapper.selectList(queryWrapper);
    }

    @Override
    public List<SysBizNotifyUser> selectSysBizNotifyUserList(SysBizNotifyUser sysBizNotifyUser) {
        return sysBizNotifyUserMapper.selectSysBizNotifyUserList(sysBizNotifyUser);
    }

    /**
     * 新增公告通知用户
     *
     * @param sysBizNotifyUser 公告通知用户
     * @return 结果
     */
    @Override
    public int insertSysBizNotifyUser(SysBizNotifyUser sysBizNotifyUser) {
        sysBizNotifyUser.setCreateTime(DateUtils.getNowDate());
        return sysBizNotifyUserMapper.insert(sysBizNotifyUser);
    }

    /**
     * 修改公告通知用户
     *
     * @param sysBizNotifyUser 公告通知用户
     * @return 结果
     */
    @Override
    public int updateSysBizNotifyUser(SysBizNotifyUser sysBizNotifyUser) {
        sysBizNotifyUser.setUpdateTime(DateUtils.getNowDate());
        return sysBizNotifyUserMapper.updateById(sysBizNotifyUser);
    }

    /**
     * 批量删除公告通知用户
     *
     * @param ids 需要删除的公告通知用户主键
     * @return 结果
     */
    @Override
    public int deleteSysBizNotifyUserByIds(Long[] ids) {
        return sysBizNotifyUserMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除公告通知用户信息
     *
     * @param id 公告通知用户主键
     * @return 结果
     */
    @Override
    public int deleteSysBizNotifyUserById(Long id) {
        return sysBizNotifyUserMapper.deleteById(id);
    }

    @Override
    public int deleteSysBizNotifyUserByNotifyId(Long notifyId) {
        LambdaQueryWrapper<SysBizNotifyUser> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SysBizNotifyUser::getNotifyId, notifyId);
        return sysBizNotifyUserMapper.delete(queryWrapper);
    }
}
